package org.daochong.fastdev.funcs;

import java.sql.SQLException;

import org.daochong.fastdev.Context;
import org.daochong.fastdev.Function;
import org.daochong.fastdev.util.FastDevUtils;
import org.daochong.lang.BeanUtil;

public class ReturnFunction implements Function {

	public boolean is(String id) {
		return FastDevUtils.operEntity("return", id);
	}

	public void exec(String key, String prop, Context context) throws SQLException {
		if (!is(key))
			return;
		String act = key.substring(key.indexOf('.') + 1);
		act = BeanUtil.formatString(act, context);
		context.add(act, context.searchValue(prop));
	}

}
